<?php $this->load->view('includes/header'); ?>
		
<script type="text/javascript">
	$(document).ready(function(){
		$("#list2").jqGrid({
		   	url:'<?= base_url() ?>index.php/sprint/getSprints',
		   	editurl: '<?= base_url() ?>index.php/sprint/edit',
			datatype: "json",
			mtype : "post",
		   	colNames:['Id','Start Date', 'End Date', 'Status'],
		   	colModel:[
		   		{name:'id',index:'id', width:50,editable:false, editoptions:{readonly:true}, sorttype:'int'},
		   		{name:'start_date',index:'start_date', width:150, editable:true,editoptions:{size:20, 						  
	                  dataInit:function(el){
	                        $(el).datepicker({dateFormat:'d/m/yy'}); 			                        
	                  }, 
	                  defaultValue: function(){ 
	                    var currentTime = new Date(); 
	                    var month = parseInt(currentTime.getMonth() + 1); 
	                    month = month <= 9 ? "0"+month : month; 
	                    var day = currentTime.getDate(); 
	                    day = day <= 9 ? "0"+day : day; 
	                    var year = currentTime.getFullYear(); 
	                    return day+"/"+month + "/"+year; 
	                  } 
	                }  ,sorttype:'date', editrules:{date:true},formatter:'date', datefmt:'d/m/Y'},
		   		{name:'end_date',index:'end_date', width:150, editable:true,editoptions:{size:20, 						  
	                  dataInit:function(el){
	                        $(el).datepicker({dateFormat:'d/m/yy'}); 			                        
	                  }, 
	                  defaultValue: function(){ 
	                    var currentTime = new Date(); 
	                    var month = parseInt(currentTime.getMonth() + 1); 
	                    month = month <= 9 ? "0"+month : month; 
	                    var day = currentTime.getDate(); 
	                    day = day <= 9 ? "0"+day : day; 
	                    var year = currentTime.getFullYear(); 
	                    return day+"/"+month + "/"+year; 
	                  } 
	                } , sorttype:'date', editable:true, editrules:{date:true},formatter:'date', datefmt:'d/m/Y'},
		   		{name:'status',index:'status', width:150, editable:true,edittype: "select", editoptions: { value: { 'Open': 'Open', 'In Progress': 'In Progress','Closed':'Closed'} }},
		   	],
		   	rowNum:10,
		   	rowList:[10,20,30],
		   	pager: '#pager2',
		   	sortname: 'id',
		    sortorder: "asc",
		    viewrecords: true,
		    caption:"Sprints List"
		});
		jQuery("#list2").jqGrid('navGrid','#pager2',{},{closeAfterEdit: true},{closeAfterAdd: true},{});
	
		});
</script>

		<table id="list2"></table> 
		<div id="pager2"></div>
	</body>
</html>